import java.util.LinkedList;
import java.util.Queue;

/**
 * @Author 12629
 * @Description：
 */
public class Test {

    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree();
        binaryTree.preOrder(root);
        System.out.println();
        binaryTree.preorderTraversal(root);
        System.out.println();
        System.out.println("=================");
        binaryTree.inOrder(root);
        System.out.println();
        binaryTree.inorderTraversal(root);
        System.out.println();
        System.out.println("=================");

        binaryTree.postOrder(root);
        System.out.println();

    }
    public static void main1(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree();
        binaryTree.preOrder(root);
        System.out.println();

        binaryTree.inOrder(root);
        System.out.println();


        binaryTree.postOrder(root);
        System.out.println();


        System.out.println("节点的个数：");
        /*binaryTree.getNodeSize(root);
        System.out.println(binaryTree.nodeSize);*/
        System.out.println(binaryTree.getNodeSize2(root));

        System.out.println("叶子节点的个数：");
        /*binaryTree.getLeafNodeCount(root);
        System.out.println(binaryTree.leafCount);*/
        System.out.println(binaryTree.getLeafNodeCount2(root));

        System.out.println("第K层的节点个数：");
        System.out.println(binaryTree.getKLevelNodeCount(root,1));
        System.out.println("树的高度：");
        System.out.println(binaryTree.getHeight(root));

        System.out.println("查找：");
        BinaryTree.TreeNode ret = binaryTree.find(root, 'A');
        System.out.println(ret.val);

        System.out.println("层序遍历：");
        binaryTree.levelOrder(root);
        System.out.println();
        System.out.println("判断完全二叉树：");
       /* Queue<BinaryTree.TreeNode> queue = new LinkedList<>();
        queue.offer(null);
        queue.offer(null);
        queue.offer(null);
        queue.offer(null);
        System.out.println(queue.isEmpty());
        System.out.println(queue.size());*/

        System.out.println(binaryTree.isCompleteTree(root));
    }
}
